package br.com.fafica.fast_restaurant.control;

import java.util.ArrayList;
import java.util.Vector;

import javax.swing.table.DefaultTableModel;

import br.com.fafica.fast_restaurant.model.Cliente;
import br.com.fafica.fast_restaurant.model.mesa;

public class ControlMesa {
	
	private mesa objMesa;

	public ControlMesa() {
		this.objMesa = new mesa();
	}

	public int Salvar(ArrayList<Integer> pList) {

		this.objMesa.setCod(pList.get(0));
		this.objMesa.setQuant_lugar(pList.get(1));


		this.objMesa.Salvar();
		return this.objMesa.getCod();

	}
	public DefaultTableModel Pesquisa (ArrayList<String> Parametros, DefaultTableModel ModeloTabela){
		String Valor = Parametros.get(0);
		ArrayList<mesa> mesas = this.objMesa.Pesquisa(Valor);
		Vector<String> vetVetor;
		mesa objClienteBuffer;
		for (int i = 0; i<mesas.size(); i++){
			vetVetor = new Vector<String>();
			objClienteBuffer = mesas.get(i);
			
			vetVetor.addElement(String.valueOf(objClienteBuffer.getCod()));
			vetVetor.addElement(String.valueOf(objClienteBuffer.getQuant_lugar()));
			
			ModeloTabela.addRow(vetVetor);
		}
		return ModeloTabela;
	}

	
}
